package num771;

import java.util.HashSet;

/**
 * @author : DuJiabao
 * @Date : 2021/1/28 14:30
 * @Project : sword-finger-offer
 * @File : null.java
 * @Desc :
 */
class Solution2 {
    public int numJewelsInStones(String jewels, String stones) {
        int count = 0;
        HashSet<Character> hashSet = new HashSet<>();
        for (int i = 0; i < jewels.length(); i++) {
            hashSet.add(jewels.charAt(i));
        }
        for (int i = 0; i < stones.length(); i++) {
            if (hashSet.contains(stones.charAt(i))) {
                count++;
            }
        }
        return count;
    }
}
